package com.im.test.constant;

public class WebSocketBaseRequestType {
    public enum RequestAction {
        /**
         * 用户登录
         */
        LOGIN_IN((short) 100),
        /**
         * 被其他玩家顶替
         */
        LOGIN_OUT_COVER((short) 102),
        /**
         * 通用消息
         */
        GENERAL_MESSAGE((short) 999),

        /**
         * pingpong 消息
         */
        PINGPONG((short) 1000),

        /**
         * 确认回执消息
         */
        CONFIRM_MSSAGE((short) 1001);

        private short value;

        private RequestAction(short value) {
            this.value = value;
        }

        public short getValue() {
            return value;
        }

        // 普通方法
        public static RequestAction getEnum(short value) {
            for (RequestAction c : RequestAction.values()) {
                if (c.getValue() == value) {
                    return c;
                }
            }
            return null;
        }
    }

}
